## Test common parsing errors general to all supported binary formats.

# RUN: yaml2obj %s -o %t

# RUN: not llvm-objcopy --redefine-sym bar %t /dev/null 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT
# BAD-FORMAT: bad format for --redefine-sym

# RUN: not llvm-objcopy --redefine-sym foo=f1 --redefine-sym foo=f2 %t /dev/null 2>&1 | FileCheck %s --check-prefix=MULTIPLE-REDEFINITION
# MULTIPLE-REDEFINITION: multiple redefinition of symbol 'foo'

# RUN: echo '  foo   oof #rename foo  ' > %t.rename.txt
# RUN: echo 'bar' >> %t.rename.txt
# RUN: not llvm-objcopy --redefine-syms %t.rename.txt %t /dev/null 2>&1 | FileCheck %s --check-prefix=MISSING-SYM-NAME
# MISSING-SYM-NAME: error: {{.*}}.rename.txt:2: missing new symbol name

# RUN: not llvm-objcopy --redefine-syms %t.rename-none.txt %t /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NO-FILE
# NO-FILE: error: '{{.*}}.rename-none.txt': [[MSG]]

!ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:  .text
    Type:  SHT_PROGBITS
    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
  - Name:    foo
    Section: .text
  - Name:    bar
    Section: .text
